/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package game;

import java.util.Queue;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author sleep
 */
public class ThreadPool {
    
    private final static ThreadPool INSTANCE = new ThreadPool(); 
    
    private final ThreadPoolExecutor EXEC = new ThreadPoolExecutor(POOL_SIZE, POOL_SIZE, 1, TimeUnit.HOURS, new LinkedBlockingQueue<Runnable>(10000));
    
    private final static int POOL_SIZE = 100;
    
    private final static AtomicInteger pool_count = new AtomicInteger(0);
    
    private ThreadPool() {
    }
    
    public static ThreadPool getPool() {
        return INSTANCE;
    }
    
    public void execute(Runnable tusk) {
        EXEC.execute(tusk);
    }
    
    public void shutdown() {
        EXEC.shutdown();
    }
}
